package com.project.demo.controller;


import com.project.demo.controller.base.BaseController;
import com.project.demo.entity.CodeHistory;
import com.project.demo.entity.CodeHistoryDto;
import com.project.demo.entity.Result;
import com.project.demo.service.CodeHistoryServie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("codeHistory")
public class CodeHistoryController extends BaseController<CodeHistory, CodeHistoryServie> {

	@Autowired
	public CodeHistoryController(CodeHistoryServie service) {
		setService(service);
	}

	@Autowired
	private CodeHistoryServie codeHistoryServie;

	@PostMapping("/save")
	public Result<Object> saveCodeHistory(@RequestBody CodeHistoryDto codeHistoryDto) {
		return codeHistoryServie.saveCodeHistory(codeHistoryDto);
	}

	@GetMapping("/list")
	public Map<String, Object> listCodeHistory(@RequestParam(value = "page", defaultValue = "1") Integer page,
	                                           @RequestParam(value = "size", defaultValue = "10") Integer size,
	                                           Integer conn_user) {
		return success(codeHistoryServie.listCodeHistory(page, size, conn_user));


	}
}
